/*
 * Copyright (c) 2016 zhangcm. All Rights Reserved.
 */
package com.jnzc.ocr.serv.shop.api.impl;

import com.jnzc.ocr.common.bean.PageResult;
import com.jnzc.ocr.common.utils.ValidateUtils;
import com.jnzc.ocr.serv.shop.api.ShopMarketingRuleApi;
import com.jnzc.ocr.serv.shop.entity.ShopMarketingRule;
import com.jnzc.ocr.serv.shop.entity.ShopMarketingRule;
import com.jnzc.ocr.serv.shop.filter.ShopMarketingRuleFilter;
import com.jnzc.ocr.serv.shop.service.ShopMarketingRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangcm
 * @version 1.0, 2017/9/13
 */
@RestController
public class ShopMarketingRuleApiImpl implements ShopMarketingRuleApi {

    @Autowired
    private ShopMarketingRuleService shopMarketingRuleService;

    @Override
    public ShopMarketingRule find(@RequestParam("id") Long id, @RequestParam("shopId") Long shopId) {
        return shopMarketingRuleService.find(id, shopId);
    }

    @Override
    public PageResult<ShopMarketingRule> search(@RequestBody ShopMarketingRuleFilter filter, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) {
        return shopMarketingRuleService.search(filter, pageNo, pageSize);
    }

    @Override
    public ShopMarketingRule save(@RequestBody ShopMarketingRule obj) {
        return shopMarketingRuleService.save(obj);
    }

    @Override
    public void delete(@RequestParam("id") Long id, @RequestParam("shopId") Long shopId) {
        ShopMarketingRule obj = find(id, shopId);
        shopMarketingRuleService.delete(id);
    }
}
